# coding=utf-8
debug = False;
head_len = 8;
thread_limit = 4;
db_charset = "UTF8";
db_thread_limit = 4;
insert_job_limit = db_thread_limit*5;
mysql_connect_timeout = 60;

#定义
error_msg={};
error_msg[-10000] = "未知错误";
error_msg[-1000] = "内容长度解析错误";
error_msg[-1001] = "命令不存在";

#get id 服务器ip
get_id_host='192.168.1.89';
#get id 服务端口
get_id_port =2626;

#get id hash 常量 
db_hash =['db1','db2','db3','db4'];
table_hash = ['t1','t2','t3','t4'];

#设置数据库跟表的hash长度
db_hash_len = 3;
table_hash_len =2;

#设置用户id hash 数量
user_hash_num = 100;

#get id 服务数据库配置
get_id_db_host = "localhost";
get_id_db_user = "root";
get_id_db_pwd = "123456";
get_id_db_name= "say8_demo";
get_id_db_get_sql ="INSERT INTO `mc_auto_id` (`id`)VALUES (NULL)";

#insert server
#insert_db_host = "192.168.1.89";

#插入数据库
insert_db_name ="say8_";
#插入表名
insert_table_name = "_t_main_card";
#服务端配置
insert_server = {'host':'localhost','user':'root','pwd':'123456','db_name':'say8_demo'};
update_field_sql = "UPDATE t_main_card_temp SET `mc_state`=2 WHERE `mc_state`=1";
get_field_sql = "SELECT * FROM t_main_card_temp WHERE `mc_state`=2";
del_field_sql = "DELETE FROM t_main_card_temp WHERE `mc_state`=2";

#插入数据服务器配置
insert_cli = {};
insert_cli['db1']={'host':'localhost','user':'root','pwd':'123456'};
insert_cli['db2']={'host':'localhost','user':'root','pwd':'123456'};
insert_cli['db3']={'host':'localhost','user':'root','pwd':'123456'};
insert_cli['db4']={'host':'localhost','user':'root','pwd':'123456'};

#导出表格式 库前缀 表前缀 id 内容
insert_field_hash={'mc_id':0,'user_id':1,'mc_contents':2,'mc_type':3,'mc_mutuality_mc_id':4,'mc_to_uid':5,'mc_mutuality_uid':6,'mc_topics':7,'mc_state':8,'mc_sub':9,'mc_sub_value':10,'mc_medium_type':11,'mc_send_type':12,'mc_time':13};
#主贴索引hash
insert_index_field_hash={'mc_id':0,'mc_type':3,'mc_mutuality_mc_id':4,'mc_to_uid':5,'mc_sub':9,'mc_medium_type':11,'mc_send_type':12,'mc_time':13};
insert_field_id_name = "mc_id";
#导出表 库前缀
insert_field_db = 14;
#导出表 表前缀
insert_field_tb = 15;

#导出表类别是否为主贴
insert_field_type = insert_field_hash["mc_type"];
#唯一id
#insert_field_id = insert_field_hash[insert_field_id_name];
#主贴id
insert_field_mc_id = insert_field_hash[insert_field_id_name];
#发言人id
insert_field_uid = insert_field_hash["user_id"];
#被评论人id
insert_field_to_uid = insert_field_hash["mc_to_uid"];
#话题id
insert_field_topic = insert_field_hash["mc_topics"];
#相关id
insert_field_mutuality = insert_field_hash["mc_mutuality_mc_id"];

#建立索引服务
make_index_host = '192.168.1.89';
make_index_port = 2929;



search_index={};
index_cmd={};

#主贴关系
#用户跟主贴id的关系
search_index['user_mc'] = {'obj':'user_index','thread_num':1,'dir':'user_mc/','type':'user'};
#用户与主贴的关系
index_cmd[2001] = 'user_mc';
index_cmd[2003] = 'user_mc';

search_index['topic_mc'] = {'obj':'topic_index','thread_num':1,'dir':'topic_mc/','type':'topic'};
#话题与主贴
index_cmd[2005] = 'topic_mc';
index_cmd[2007] = 'topic_mc';

#跟帖关系
#主贴id跟跟帖
search_index['mc_fc'] = {'obj':'mc_index','thread_num':1,'dir':'mc_fc/','type':'mc'};
#主贴与跟帖的关系
index_cmd[2009] = 'mc_fc';
index_cmd[2011] = 'mc_fc';

#用户与跟帖的关系
search_index['user_fc'] = {'obj':'user_index','thread_num':1,'dir':'user_fc/','type':'user'};
index_cmd[2013] = 'user_fc';
index_cmd[2015] = 'user_fc';

#被评论用户与跟帖的关系
search_index['fc_to_user'] = {'obj':'user_index','thread_num':1,'dir':'fc_to_user/','type':'user'};
index_cmd[2017] = 'fc_to_user';
index_cmd[2019] = 'fc_to_user';

#用户关系
#我关注的用户
search_index['user_f'] = {'obj':'user_index','thread_num':1,'dir':'user_f/','type':'user'};
index_cmd[2021] = 'user_f';
index_cmd[2023] = 'user_f';
#关注我的用户
search_index['f_user'] = {'obj':'user_index','thread_num':1,'dir':'f_user/','type':'user'};
index_cmd[2025] = 'f_user';
index_cmd[2027] = 'f_user';



#添加索引的命令
index_add=[2001,2005,2009,2013,2017,2021,2025];
#删除索引的命令
index_del=[2003,2007,2011,2015,2019,2023,2027];


#话题跟主贴
#search_index['topic_mc'] = '';
#我关注的用户
#search_index['my_focus'] = '';
#关注我的
#search_index['focus_me'] = '';


#我关注的话题
#search_index['my_topic'] = '';
#话题被关注
#search_index['topic_me'] = '';


#获取数据服务
get_thread_num = 10;